using System.Collections.Generic;
using System.IO;
using System.Text;
using LiteTools.tools;
using Sunny.UI;

namespace LiteTools.service.analyzer
{
    public class TlvAnalyzer
    {
        public static string GetTagLengthDesc(string tag, string length)
        {
            var builder = new StringBuilder("\t## ");
            var deserialize = Json.Deserialize<Dictionary<string, string>>(File.ReadAllText("..\\..\\resources\\TagLengthInfos.json"));
            builder.Append(deserialize.TryGetValue(tag, out var value) ? value : "未知的TAG数据。");
            var decLength = TlvUtil.GetDecLength(length);
            builder.Append("长度数据为：").Append(length).Append("，十进制表示为：").Append(decLength);
            return builder.ToString();
        }
    }
}